<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
     protected function _initRoutes(){
        
        $front = Zend_Controller_Front::getInstance();
        $front->addModuleDirectory(APPLICATION_PATH . "/modules");
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
        $router = new Zend_Controller_Router_Rewrite();          
        $router = $router->addConfig($config, 'routes');          
        $front->setRouter($router);                          
        return $front;
    }
    
    protected function _initTranslate() {
		
        // Registry locale
        $locale = new Zend_Locale('vi_VN');
        Zend_Registry::set('Zend_Locale', $locale);
        
        //create session block and save locale
        $session = new Zend_Session_Namespace('session');
        $langLocale = isset($session->lang)? $session->lang : $locale;
        
        // Set up and load the translations (all of them!)
        $translate = new Zend_Translate(
                'gettext', 
                APPLICATION_PATH.DIRECTORY_SEPARATOR.'languages', 
                $langLocale, 
                array('disableNotices' => true));
        
        //$translate->setLocale($langLocale); // Use this if you only want to load the translation matching current locale, experiment.
        
        //Save for late
        $registry = Zend_Registry::getInstance();
        $registry->set('Zend_Translate', $translate);
    }

}

